<?php include("../db.php");
$games=$_GET["games"];

$db=pg_connect("host=dbsrv1 dbname=csc309g7 user=csc309g7 password=aiboid4p");
if (!$db)
  {
  echo "Database connection failed.<br/>";
  exit;
  }

mysql_select_db("ajax_demo", $con);

$search="SELECT * FROM games WHERE sid = '".$games."' order by start_date";

$result = pg_query($search);

echo "<table border='1'>
<tr>
<th>GameID</th>
<th>Sid</th>
<th>Creator ID</th>
<th>Start date</th>
<th>Start time</th>
<th>Location ID</th>
<th>Title</th>

</tr>";

while($buff = pg_fetch_assoc($result))
  {
  echo "<tr>";
  echo "<td>" . $buff['gameid'] . "</td>";
  echo "<td>" . $buff['sid'] . "</td>";
  echo "<td>" . $buff['creator'] . "</td>";
  echo "<td>" . $buff['start_date'] . "</td>";
  echo "<td>".$buff['start_time']."</td>";
  echo "<td>".$buff['location']."</td>";
  echo "<td>".$buff['title']."</td>";
  echo "</tr>";
  }
echo "</table>";


?> 
